'''
单继承
多继承
'''
# 1、单继承
class Fish:
    def swim(self):
        print('我会游泳')
class Goldfish(Fish):
    def tupaopao(self):
        print('我会吐泡泡')
fish1=Goldfish()
fish1.tupaopao()
fish1.swim()

# 2、多继承
class Bird:
    def fly(self):
        print('我会飞')
class Flyfish(Fish,Bird):
    def fly(self):
        print('我会滑翔')
fish2=Flyfish()
fish2.swim()
fish2.fly()

print('-------------------------------')
# 扩展：子类调用父类的构造方法
class Fish:
    def __init__(self,category):
        self.category=category
        print(f'我的{category}类')
    def swim(self):
        print('我会游泳')
class Goldfish(Fish):
    def __init__(self,category):
        super().__init__(category)

    def tupaopao(self):
        print('我会吐泡泡')
fish3=Goldfish('鱼')
fish3.swim()

print('-------------------------------')
# 扩展：子类调用多个父类的构造方法
class Fish:
    def __init__(self,category):
        self.category=category
        print(f'我的{category}类')
    def swim(self):
        print('我会游泳')
class Bird:
    def __init__(self, category):
        self.category = category
        print(f'我的{category}类')
    def fly(self):
        print('我会飞')
class Flyfish(Fish,Bird):
    def __init__(self,*args):
        super().__init__(args)
    def fly(self):
        print('我会滑翔')
fish4=Flyfish('鱼','飞鱼')
fish4.swim()
fish4.fly()